From: Keir Fraser Date: Wed, 3 Jun 2009 10:10:07 +0000 (+0100) Subject: blktap2: human readable output for tapdisk2 creation problems X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13826 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=09c8ee7eaca8262064544fe50ba4ed5ddad56b0e;p=xen.git blktap2: human readable output for tapdisk2 creation problems This patch fixes the "file object has no attribute find" failure we've been seeing when starting blktap2 devices and adds more meaningful error output to conditions where the tapdisk2 process is unable to create a blktap2 device. Signed-off-by: Dutch Meyer --- diff --git a/tools/python/xen/xend/server/BlktapController.py b/tools/python/xen/xend/server/BlktapController.py index 682b7e1b1e..7c592932c2 100644 --- a/tools/python/xen/xend/server/BlktapController.py +++ b/tools/python/xen/xend/server/BlktapController.py @@ -32,7 +32,7 @@ def doexec(args, inputtext=None): proc.tochild.write(inputtext) stdout = proc.fromchild stderr = proc.childerr - rc = proc.poll() + rc = proc.wait() return (rc,stdout,stderr) def parseDeviceString(device): @@ -131,7 +131,16 @@ class BlktapController(BlkifController): cmd = [ TAPDISK_BINARY, '-n', '%s:%s' % (params, file) ] (rc,stdout,stderr) = doexec(cmd) - minor, device, control = parseDeviceString(stdout) + if rc != 0: + err = stderr.read(); + out = stdout.read(); + stdout.close(); + stderr.close(); + raise Exception, 'Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file); + + minor, device, control = parseDeviceString(stdout.readline()) + stdout.close(); + stderr.close(); #modify the configuration to attach as a vbd, now that the #device is configured. Then continue to create the device